package com.example.logdemo.web;

import com.example.logdemo.log.Loggable;
import com.example.logdemo.service.DemoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @author zhiyuan
 * @date 2025/10/28
 */
@RestController
@Loggable(tag = "controller")
public class DemoController {

    private final DemoService demoService;

    public DemoController(DemoService demoService) {
        this.demoService = demoService;
    }

    @GetMapping("/api/echo")
    public String echo(@RequestParam String text,
                       @RequestParam(required = false, defaultValue = "secret") String password) {
        return demoService.echo(text, password);
    }
}
